<h3>Gerenciar Bancas</h3>

<table border="1" cellspacing="0" cellpadding="0">
	<tr>
		<th>Aluno</th>
		<th>Orientador</th>
		<th>Titulo do projeto</th>
		<th>Data</th>
		<th>Hora</th>
		<th>Local</th>
		<th>Aprovada</th>
		<th>Professores da banca</th>
		<th class="editar">Editar</th>
		<th class="excluir">Excluir</th>
	</tr>
	<?php foreach ($examining_boards as $e): ?>
	<tr>
      <td>
      <?php 
      foreach ($students as $s):
         if ($e['FinalWork']['student_id'] == $s['Student']['numero_matricula'])
         {
            echo $s['Student']['nome'];
            break;
         }
      endforeach;
      ?>
      </td>
      <td>
      <?php
      foreach ($teachers as $t):
         if ($e['FinalWork']['teacher_id'] == $t['Teacher']['cpf'])
         {
            echo $t['Teacher']['nome'];
            break;
         }
      endforeach;
      ?>
      </td>
		<td><?php echo $e['FinalWork']['titulo']; ?></td>

		<td><?php echo $e['ExaminingBoard']['data_apresentacao']; ?></td>
		<td><?php echo $e['ExaminingBoard']['hora_apresentacao']; ?></td>
		<td><?php echo $e['ExaminingBoard']['local_apresentacao']; ?></td>
		<td><?php echo $e['ExaminingBoard']['aprovado_colegiado']; ?></td>
		<td>
      <?php foreach ($e['BoardTeacher'] as $b): ?>
      <?php 
      foreach ($teachers as $t):
         if ($b['teacher_id'] == $t['Teacher']['cpf']) echo $t['Teacher']['nome'].'<br />';
      endforeach;
      ?>
   	<?php endforeach; ?>
		</td>
		<td class="editar">	
			<?php echo $html->link('Editar', '/examining_boards/edit/'.$e['ExaminingBoard']['id'] );?>
		</td>
		<td>
			<?php echo $html->link('Excluir',  "/examining_boards/delete/{$e['ExaminingBoard']['id']}", null, 'Deseja realmente excluir?' )?>
		</td>
	</tr>
	<?php endforeach; ?> 
</table>
